﻿using MCPlatform.UI.Controls.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace MCPlatform.UI.Controls.Views.MotionControl
{
    /// <summary>
    /// Valve.xaml 的交互逻辑
    /// </summary>
    public partial class Valve : UserControl
    {
        public Valve()
        {
            InitializeComponent();
        }




        public ValveModel ValveModel
        {
            get { return (ValveModel)GetValue(ValveModelProperty); }
            set { SetValue(ValveModelProperty, value); }
        }

        // Using a DependencyProperty as the backing store for MyProperty.  This enables animation, styling, binding, etc...
        public static readonly DependencyProperty ValveModelProperty =
            DependencyProperty.Register("ValveModel", typeof(ValveModel), typeof(Valve), new PropertyMetadata(default));



        /// <summary>
        /// 点击Base按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BaseButton_Click(object sender, RoutedEventArgs e)
        {
            if (ValveModel is null || ValveModel.ValveEntity is null) { return ; }

            ValveModel.ValveEntity.BasingAsync();
        }


        /// <summary>
        /// 点击Work按钮
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void WorkButton_Click(object sender, RoutedEventArgs e)
        {
            if (ValveModel is null || ValveModel.ValveEntity is null) { return; }

            ValveModel.ValveEntity.WorkingAsync();
        }

        private bool ValveIsNull()
        {
            if (ValveModel is null || ValveModel.ValveEntity is null) { return true; }

            return false;
        }
    }
}
